#ifndef __RGB_H__
#define __RGB_H__

#include "main.h"
#include "fft.h"
void RgbInit(void);

void colorArrClear(void); // 对RGB进行复位

void SetColorArr(uint32_t color, uint8_t pos); //设置ColorArr[pos],将color放入ColorArr数组的pos位，即将第pos个灯设置成color颜色

void SetColorArrs(uint32_t color, uint8_t StartPos, uint8_t len); //设置多个color至ColorArr数组中，起始位置为StartPos，长度为len

void RgbWrite(uint32_t *colorArr, uint8_t colorLen, uint8_t which_rgb); //将设置好的color[],写入到对应的rgb灯当中

void TestFun(uint8_t *pRegH, uint8_t len, uint8_t which_rgb, uint32_t color); //rgb测试函数

void RgbUpData(uint8_t which_rgb);

void RgbShow_FFT_Mode1(void);		 //从下至上开始跳动，颜色变换
void RgbShow_FFT_Mode2(uint8_t pos); //从下至上开始跳动，颜色全部加深
void RgbShow_FFT_Mode4(uint8_t pos); //从下至上开始跳动，颜色从下至上逐渐加深
void RgbShow_FFT_Mode3(uint8_t pos); //从中间向两端跳动，颜色全部加深
void RgbShow_FFT_Mode5(uint8_t pos); //从中间向两端跳动，颜色从下至上逐渐加深

void RgbShow_FFT_Mode6(uint8_t pos); //流水灯模式

typedef struct RgbStruct
{
	uint8_t w;
	uint8_t b;
	uint8_t g;
	uint8_t r;
} RgbStruct;

typedef union RgbUnion
{
	RgbStruct rgb;
	uint32_t u32;
} RgbUnion;

void ColorDeepen(uint8_t mainColor, uint8_t startColor, uint8_t pos, uint8_t rgbStartpos, uint8_t rgbShowLen);					 //Color deepening when 'rgbShow_Hight' increased
void ColorIncre(uint8_t mainColor, uint8_t startColor, uint8_t endColor, uint8_t pos, uint8_t rgbStartpos, uint8_t rgbShowLen);	 //颜色渐变
void ColorIncre2(uint8_t mainColor, uint8_t startColor, uint8_t endColor, uint8_t pos, uint8_t rgbStartpos, uint8_t rgbShowLen); //颜色渐变(从中间向两边加深)

#endif
